package com.tuyue.police.weixin.controller.weixin;

import com.tuyue.police.biz.IUserBiz;
import com.tuyue.police.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author: 王金海
 * @Description:
 * @Date: Created by Administrator on 2018/3/20.
 * @Modified By:
 */
@Controller
@RequestMapping("weixin")
public class IndexController {
    @Autowired
    private IUserBiz userBiz;

    @GetMapping("bjjl")
    public String bjjl(){
        return "bjjl";
    }
//    @GetMapping("grzx")
//    public String grzx(String openId){
//
//        return "grzx";
//    }
    @GetMapping("yjbj")
    public String yjbj(){
        return "yjbj";
    }
    @PostMapping("bd")
    public ModelAndView bdzc(String openId, String phone, String password, Model model){
        User user = userBiz.bangding(openId, phone, password);
        model.addAttribute("user",user);
        return new ModelAndView("grzx","user",model);
    }
}
